Skip to content

Make --enable-embed libs respect --libdir #12389

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from

Conversation

adsr
Copy link
Contributor

@adsr adsr commented Oct 9, 2023

And make locatable by via php-config. Prior to this, libphp.* would always install to $prefix/lib. After this, they will install to $libdir.

In practice, this will make it so that programs embedding libphp can use php-config to determine appropriate compile flags without guessing.

In configure.ac, it seems $libdir is mutated in some instances. Ideally the mutated version would be stored in $phplibdir or something. Instead of tracking down all uses of that variable, I introduced another variable $orig_libdir that holds the original value passed to the configure script.

This is a no-op for users unless they are compiling with --libdir set to something other than $prefix/lib, the default.

@adsr
Copy link
Contributor Author

adsr commented Oct 9, 2023

Hi @petk, here's another build-related PR. Technically this PR addresses two separate concerns:

  • libphp.* doesn't respect --libdir. It always installs to $prefix/lib. To me this seems like a small bug.
  • php-config doesn't have enough info to confidently locate libphp. If a user knows that the build always installs to $prefix/lib, they can of course use -L$(php-config --prefix)/lib, but for those who don't know that bit of trivia, it feels like a guess.

@Girgias Girgias requested a review from petk October 9, 2023 14:22
@adsr
Copy link
Contributor Author

adsr commented Nov 20, 2023

Bump @petk

@petk
Copy link
Member

petk commented Jan 6, 2024

I'm onto this in the following days, thanks for your patience...

@petk
Copy link
Member

petk commented Jan 18, 2024

I'll just recheck this a bit further but overall it's all ok. Yes, I totally agree that php-config script needs to have also embed info. Good suggestions.

@petk
Copy link
Member

petk commented Jan 27, 2024

I'll just add note here to not forget when merging this... The approximate change for the php-config man page:

diff a/scripts/man1/php-config.1.in b/scripts/man1/php-config.1.in
--- a/scripts/man1/php-config.1.in
+++ b/scripts/man1/php-config.1.in
@@ -39,6 +39,14 @@ Directory where extensions are searched by default
 Directory prefix where header files are installed by default
 .TP
 .PD 0
+.B \-\-lib-dir
+Directory where libraries are installed by default
+.TP
+.PD 0
+.B \-\-lib-embed
+PHP embed library name
+.TP
+.PD 0
 .B \-\-php-binary
 Full path to php CLI or CGI binary
 .TP

And make locatable by via `php-config`. Prior to this, `libphp.*`
would always install to `$prefix/lib`. After this, they will install
to `$libdir`.

In practice, this will make it so that programs embedding libphp can
use `php-config` to determine appropriate compile flags without
guessing.

In `configure.ac`, it seems `$libdir` is mutated in some instances.
Ideally the mutated version would be stored in `$phplibdir` or
something. Instead of tracking down all uses of that variable, I
introduced another variable `$orig_libdir` that holds the original
value passed to the configure script.

This is a no-op for users unless they are compiling with `--libdir`
set to something other than `$prefix/lib`, the default.
@adsr adsr force-pushed the libphp_respect_libdir_phpconfig branch from de10975 to 04f99a7 Compare February 16, 2024 03:03
@adsr
Copy link
Contributor Author

adsr commented Feb 16, 2024

Thank you @petk. I've incorporated your changes.

@petk
Copy link
Member

petk commented Mar 10, 2024

@adsr thanks for your patience. Yes, it is taking abnormally long :) Issue is that I'm still checking how everything fits together. And merge is coming up soon here, no worries.

What I'm currently also thinking is adding additional pkgconf template for PHP. Like an optional add-on:

build/php.pc.in:

prefix=${prefix}
exec_prefix=${exec_prefix}
includedir=${prefix}/include...
libdir=${exec_prefix}/lib

Name: php
Description: PHP, a general-purpose scripting language
Version: ${php_version}
Cflags: -I${includedir}/php/...
Libs: -L${libdir} -lphp

So, it can be used together with pkgconf command-line utility. If PHP extensively already uses pkgconf for many dependencies, it should also provide pkgconf template for installation, I believe.

And, I'll probably just sync these libdir names a bit. But this is just for the info, nothing to change in the PR...

@petk
Copy link
Member

petk commented Mar 23, 2024

Thanks @adsr added to master branch (upcoming into PHP-8.4). We'll sync this further with pkgconf and the rest of the options in the future so this embed SAPI can be perhaps a bit easier to use.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants